package com.sghd.fight.module.game.service.skill;

import com.sghd.fight.module.game.config.SkillConfig;
import com.sghd.fight.module.game.core.model.Unit;
import com.sghd.fight.module.game.service.room.IRoom;
import com.sghd.fight.module.game.service.work.RoomRunner;

import java.util.Date;

/**
 * @author frank
 * @date 2018-10-24 13:35
 * @desc
 **/
public class SkillExecuteRunner implements RoomRunner {
    private Unit owner;
    private Context context;
    private SkillConfig skillConfig;
    private IRoom room;
    public static SkillExecuteRunner valueOf(Unit owner, Context context, SkillConfig config ,IRoom room) {
        SkillExecuteRunner runner = new SkillExecuteRunner();
        runner.owner = owner;
        runner.context = context;
        runner.skillConfig = config;
        runner.room = room;
        return runner;
    }

    @Override
    public void run(Date now) {
        if (room.isOver()) {//战斗已经结束
            return;
        }
        context.effect();
    }

    public Unit getOwner() {
        return owner;
    }

    public void setOwner(Unit owner) {
        this.owner = owner;
    }

    public Context getContext() {
        return context;
    }

    public void setContext(Context context) {
        this.context = context;
    }

    public SkillConfig getSkillConfig() {
        return skillConfig;
    }

    public void setSkillConfig(SkillConfig skillConfig) {
        this.skillConfig = skillConfig;
    }
}
